package com.lzxuni.modules.disease.service.impl;

import com.lzxuni.modules.common.entity.PageParameter;
import com.lzxuni.modules.disease.entity.DiseaseInformation;
import com.lzxuni.modules.disease.mapper.DiseaseInformationMapper;
import com.lzxuni.modules.disease.service.DiseaseInformationService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import java.util.List;
import com.lzxuni.common.utils.StringUtils;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

/**
 * <p>
 * 病情管理--病情详情 服务实现类
 * </p>
 *
 * @author gyl
 * @since 2020-12-02
 */
@Service
public class DiseaseInformationServiceImpl extends ServiceImpl<DiseaseInformationMapper, DiseaseInformation> implements DiseaseInformationService {

    @Override
    public PageInfo<DiseaseInformation> queryPage(PageParameter pageParameter, DiseaseInformation diseaseInformation) {
        if (StringUtils.isNotEmpty(pageParameter.getSidx())) {
            PageHelper.startPage(pageParameter.getPage(), pageParameter.getRows()).setOrderBy(
                    pageParameter.getSidx() + " " + pageParameter.getSord());
        } else {
            PageHelper.startPage(pageParameter.getPage(), pageParameter.getRows());
        }
        List<DiseaseInformation> diseaseInformationList = baseMapper.queryList(diseaseInformation);
        PageInfo<DiseaseInformation> pageInfo = new PageInfo<>(diseaseInformationList);
        return pageInfo;
    }

    @Override
    public List<DiseaseInformation> queryList(DiseaseInformation diseaseInformation) {
        List<DiseaseInformation> diseaseInformationList = baseMapper.queryList(diseaseInformation);
        return diseaseInformationList;
    }

}
